<?php 
// 本类由系统自动生成，仅供测试用途
class MemberAction extends Action{
    // 首页 
	public function index(){
		$Form	= D("Member");
		$list	=	$Form->top5('','*','uid desc');
		$this->assign('list',$list);
		$this->display();
	}
    // 首页 
    public function reg(){
		$Form	= D("Member");
		$list	=	$Form->top5('','*','uid desc');
		$this->assign('list',$list);
		$this->display();
    } 
    // 检查标题是否可用 
    public function checkUser() { 
        if(!empty($_POST['username'])) {
            $Member    =    D("Member"); 
            if($Member->getByUsername($_POST['username'])) { 
                $this->error('用户名'.$_POST['username'].'已经存在'); 
            }else{ 
                $this->success('用户名'.$_POST['username'].'可以使用!'); 
            } 
        }else{ 
            $this->error('用户名必须'); 
        } 
    } 
    // 处理表单数据 
    public function insert() { 
        $Member    =    D("Member"); 
        if($vo = $Member->create()) { 
            if($Member->add()){ 
                $vo['regtime'] = date('Y-m-d H:i:s',$vo['regtime']); 
                $this->ajaxReturn($vo,'注册成功！',1); 
            }else{ 
                $this->error('数据写入错误！'); 
            } 
        }else{ 
            $this->error($Member->getError()); 
        } 
    } 
    // 生成验证码 
    public function verify() { 
        import("ORG.Util.Image"); 
		Image::buildImageVerify();  
    } } 
?>